--
-- PostgreSQL database dump
--

-- Started on 2011-06-27 03:13:00

SET statement_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = off;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET escape_string_warning = off;

--
-- TOC entry 318 (class 2612 OID 16386)
-- Name: plpgsql; Type: PROCEDURAL LANGUAGE; Schema: -; Owner: postgres
--

CREATE PROCEDURAL LANGUAGE plpgsql;


ALTER PROCEDURAL LANGUAGE plpgsql OWNER TO postgres;

SET search_path = public, pg_catalog;

SET default_tablespace = '';

SET default_with_oids = false;

--
-- TOC entry 1506 (class 1259 OID 167706)
-- Dependencies: 3
-- Name: disciplina; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE disciplina (
    id integer NOT NULL,
    codigo text,
    nome text
);


ALTER TABLE public.disciplina OWNER TO postgres;

--
-- TOC entry 1505 (class 1259 OID 167704)
-- Dependencies: 3 1506
-- Name: disciplina_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE disciplina_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


ALTER TABLE public.disciplina_id_seq OWNER TO postgres;

--
-- TOC entry 1813 (class 0 OID 0)
-- Dependencies: 1505
-- Name: disciplina_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE disciplina_id_seq OWNED BY disciplina.id;


--
-- TOC entry 1814 (class 0 OID 0)
-- Dependencies: 1505
-- Name: disciplina_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('disciplina_id_seq', 33, true);


--
-- TOC entry 1512 (class 1259 OID 167768)
-- Dependencies: 3
-- Name: opcao; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE opcao (
    id integer NOT NULL,
    enunciado text,
    questaoid integer
);


ALTER TABLE public.opcao OWNER TO postgres;

--
-- TOC entry 1511 (class 1259 OID 167766)
-- Dependencies: 1512 3
-- Name: opcao_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE opcao_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


ALTER TABLE public.opcao_id_seq OWNER TO postgres;

--
-- TOC entry 1815 (class 0 OID 0)
-- Dependencies: 1511
-- Name: opcao_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE opcao_id_seq OWNED BY opcao.id;


--
-- TOC entry 1816 (class 0 OID 0)
-- Dependencies: 1511
-- Name: opcao_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('opcao_id_seq', 1, false);


--
-- TOC entry 1510 (class 1259 OID 167757)
-- Dependencies: 3
-- Name: questao; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE questao (
    id integer NOT NULL,
    enunciado text,
    dificuldade text,
    resposta_padrao text,
    opcao_correta integer,
    tipo text
);


ALTER TABLE public.questao OWNER TO postgres;

--
-- TOC entry 1509 (class 1259 OID 167755)
-- Dependencies: 3 1510
-- Name: questao_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE questao_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


ALTER TABLE public.questao_id_seq OWNER TO postgres;

--
-- TOC entry 1817 (class 0 OID 0)
-- Dependencies: 1509
-- Name: questao_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE questao_id_seq OWNED BY questao.id;


--
-- TOC entry 1818 (class 0 OID 0)
-- Dependencies: 1509
-- Name: questao_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('questao_id_seq', 1, false);


--
-- TOC entry 1508 (class 1259 OID 167741)
-- Dependencies: 3
-- Name: topico; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE topico (
    id integer NOT NULL,
    disciplinaid integer,
    nome text
);


ALTER TABLE public.topico OWNER TO postgres;

--
-- TOC entry 1507 (class 1259 OID 167739)
-- Dependencies: 3 1508
-- Name: topico_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE topico_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


ALTER TABLE public.topico_id_seq OWNER TO postgres;

--
-- TOC entry 1819 (class 0 OID 0)
-- Dependencies: 1507
-- Name: topico_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE topico_id_seq OWNED BY topico.id;


--
-- TOC entry 1820 (class 0 OID 0)
-- Dependencies: 1507
-- Name: topico_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('topico_id_seq', 10, true);


--
-- TOC entry 1790 (class 2604 OID 167709)
-- Dependencies: 1505 1506 1506
-- Name: id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE disciplina ALTER COLUMN id SET DEFAULT nextval('disciplina_id_seq'::regclass);


--
-- TOC entry 1793 (class 2604 OID 167771)
-- Dependencies: 1512 1511 1512
-- Name: id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE opcao ALTER COLUMN id SET DEFAULT nextval('opcao_id_seq'::regclass);


--
-- TOC entry 1792 (class 2604 OID 167760)
-- Dependencies: 1510 1509 1510
-- Name: id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE questao ALTER COLUMN id SET DEFAULT nextval('questao_id_seq'::regclass);


--
-- TOC entry 1791 (class 2604 OID 167744)
-- Dependencies: 1507 1508 1508
-- Name: id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE topico ALTER COLUMN id SET DEFAULT nextval('topico_id_seq'::regclass);


--
-- TOC entry 1804 (class 0 OID 167706)
-- Dependencies: 1506
-- Data for Name: disciplina; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY disciplina (id, codigo, nome) FROM stdin;
9	EDD1	Estruturas de Dados
26	LFA	Linguagens Formais
33	JUR578	Direito empresarial
\.


--
-- TOC entry 1807 (class 0 OID 167768)
-- Dependencies: 1512
-- Data for Name: opcao; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY opcao (id, enunciado, questaoid) FROM stdin;
\.


--
-- TOC entry 1806 (class 0 OID 167757)
-- Dependencies: 1510
-- Data for Name: questao; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY questao (id, enunciado, dificuldade, resposta_padrao, opcao_correta, tipo) FROM stdin;
\.


--
-- TOC entry 1805 (class 0 OID 167741)
-- Dependencies: 1508
-- Data for Name: topico; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY topico (id, disciplinaid, nome) FROM stdin;
1	26	Expressão regular
2	26	Automato Finito Deterministico
3	26	Máquina de turing
10	26	teste
\.


--
-- TOC entry 1795 (class 2606 OID 167714)
-- Dependencies: 1506 1506
-- Name: pkey_disciplina; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY disciplina
    ADD CONSTRAINT pkey_disciplina PRIMARY KEY (id);


--
-- TOC entry 1801 (class 2606 OID 167776)
-- Dependencies: 1512 1512
-- Name: pkey_opcao; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY opcao
    ADD CONSTRAINT pkey_opcao PRIMARY KEY (id);


--
-- TOC entry 1799 (class 2606 OID 167765)
-- Dependencies: 1510 1510
-- Name: pkey_questao; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY questao
    ADD CONSTRAINT pkey_questao PRIMARY KEY (id);


--
-- TOC entry 1797 (class 2606 OID 167749)
-- Dependencies: 1508 1508
-- Name: pkey_topico; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY topico
    ADD CONSTRAINT pkey_topico PRIMARY KEY (id);


--
-- TOC entry 1802 (class 2606 OID 167750)
-- Dependencies: 1506 1508 1794
-- Name: fkey_disciplina; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY topico
    ADD CONSTRAINT fkey_disciplina FOREIGN KEY (disciplinaid) REFERENCES disciplina(id);


--
-- TOC entry 1803 (class 2606 OID 167777)
-- Dependencies: 1512 1798 1510
-- Name: fkey_questao; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY opcao
    ADD CONSTRAINT fkey_questao FOREIGN KEY (questaoid) REFERENCES questao(id);


--
-- TOC entry 1812 (class 0 OID 0)
-- Dependencies: 3
-- Name: public; Type: ACL; Schema: -; Owner: postgres
--

REVOKE ALL ON SCHEMA public FROM PUBLIC;
REVOKE ALL ON SCHEMA public FROM postgres;
GRANT ALL ON SCHEMA public TO postgres;
GRANT ALL ON SCHEMA public TO PUBLIC;


-- Completed on 2011-06-27 03:13:01

--
-- PostgreSQL database dump complete
--

